home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / SCSI Samples 1.0 / SCSI Simple Sample 06⁄15 ƒ / Src / SCSIBusAPI.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-16  |  1.6 KB  |  59 lines  |  [TEXT/KAHL]

  1. /*                                SCSIBusAPI.c                            */
  2. /*
  3.  * SCSIBusAPI.c
  4.  * Copyright © 1992-94 Apple Computer Inc. All Rights Reserved.
  5.  */
  6. #include "SCSISimpleSample.h"
  7.  
  8. /*
  9.  * Check whether the asynchronous SCSI Manager may be called for this bus.
  10.  * This will return a status error if the bus is inaccessable. If successful,
  11.  * it will set useAsynchManager FALSE only if this bus is managed by a
  12.  * third-party SCSI hardware interface that operates by patching the
  13.  * original SCSI Manager traps, or uses some other private interface.
  14.  */
  15. OSErr
  16. SCSIBusAPI(
  17.         DeviceIdent                scsiDevice,
  18.         Boolean                    *useAsynchManager
  19.     )
  20. {
  21.         OSErr                        status;
  22.         SCSIBusInquiryPB            busInquiryPB;
  23. #define PB                            (busInquiryPB)
  24.  
  25.         if (AsyncSCSIPresent() == FALSE) {
  26.             *useAsynchManager = FALSE;
  27.             status = noErr;
  28.         }
  29.         else {
  30.             CLEAR(PB);
  31.             PB.scsiPBLength = sizeof PB;
  32.             PB.scsiFunctionCode = SCSIBusInquiry;
  33.             PB.scsiDevice = scsiDevice;
  34.             status = SCSIAction((SCSI_PB *) &PB);
  35.             if (status == noErr)
  36.                 *useAsynchManager = TRUE;
  37.             else if (scsiDevice.bus == 0) {
  38.                 /*
  39.                  * If bus zero is not registered, it must be accessed
  40.                  * via the original API.
  41.                  */
  42.                 status = noErr;
  43.                 *useAsynchManager = FALSE;
  44.             }
  45.             else {
  46.                 /*
  47.                  * This is a problem: this bus cannot be accessed unless it has
  48.                  * been registered. For example, the second bus of a Quadra
  49.                  * 950 cannot be accessed if the SCSI Manager extension is not
  50.                  * isntalled and a third-party asynchronous SCSI Manager card
  51.                  * is installed as bus 2. Return the error to skip this bus.
  52.                  */
  53.             }
  54.         }
  55.         return (status);
  56. #undef PB
  57. }
  58.  
  59.